package com.dcw.lixb.designmode.prototype;

import java.util.Random;

/**
 * @author lixiaobin
 * @date 2020-07-17 11:04:28
 * @desc 原型设计模式 对象的创建都是通过原型创造出来的
 */
public class PrototypePatternDemo {
    public static void main(String[] args) {
        ShapeCache.loadCache();

        Random random = new Random();
        for (int i = 0; i < 10; i++) {
            int x = random.nextInt(4);
            if (x>0) {
                Shape shape = ShapeCache.getShape(String.valueOf(x));
                System.out.println("Shape : "+shape.getType() +"  "+shape);
            }
        }
    }
}
